import React from 'react';
import { Result as AntdResult } from 'antd';
import type { ResultProps as AntdResultProps } from 'antd';
import { createStyles } from 'antd-style';

export interface ResultProps extends AntdResultProps {
  /**
   * @description 自定义样式类名
   */
  customClassName?: string;
}

const useStyles = createStyles(({ token, css }) => ({
  result: css`
    padding: ${token.padding}px;
  `,
}));

const Result: React.FC<ResultProps> = ({ customClassName, className, ...restProps }) => {
  const { styles, cx } = useStyles();
  
  const resultClassName = cx(
    className,
    customClassName,
    styles.result
  );

  return <AntdResult className={resultClassName} {...restProps} />;
};

export { Result };
export default Result;

